﻿using System.ComponentModel;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;

namespace estoque
{
    /// <summary>
    /// Interaction logic for EllipseIcon.xaml
    /// </summary>
    public partial class EllipseIcon : UserControl
    {
        public EllipseIcon()
        {
            InitializeComponent();
        }

        [Bindable(true)]
        public Brush Color
        {
            get { return this.ellipse.Stroke; }
            set
            {
                this.ellipse.Stroke = value;
                this.textBlock.Foreground = value;
            }
        }

        [Bindable(true)]
        [Category("Appearance")]
        [Localizability(LocalizationCategory.ToolTip)]
        public new object ToolTip
        {
            get { return this.textBlock.ToolTip; }
            set { this.textBlock.ToolTip = value; }
        }

        public static readonly DependencyProperty TextContentProperty = DependencyProperty.Register("TextContent", typeof(string), typeof(EllipseIcon));

        public string TextContent
        {
            get { return (string)GetValue(TextContentProperty); }
            set { SetValue(TextContentProperty, value); }
        }

        protected override void OnPropertyChanged(DependencyPropertyChangedEventArgs e)
        {
            base.OnPropertyChanged(e);

            if (e.Property == TextContentProperty)
            {
                this.textBlock.Text = (string)e.NewValue;
            }
        }
    }
}